math/big.Int.abs (field)
405 uses
math/big (current package)
float.go#L610: if len(x.abs) == 0 {
float.go#L615: z.mant = z.mant.set(x.abs)
float.go#L1115: z.abs = z.abs.shl(x.mant, exp-allBits)
float.go#L1117: z.abs = z.abs.set(x.mant)
float.go#L1119: z.abs = z.abs.shr(x.mant, allBits-exp)
float.go#L1155: z.a.abs = z.a.abs.shl(x.mant, uint(x.exp-allBits))
float.go#L1156: z.b.abs = z.b.abs[:0] // == 1 (see Rat)
float.go#L1159: z.a.abs = z.a.abs.set(x.mant)
float.go#L1160: z.b.abs = z.b.abs[:0] // == 1 (see Rat)
float.go#L1163: z.a.abs = z.a.abs.set(x.mant)
float.go#L1164: t := z.b.abs.setUint64(1)
float.go#L1165: z.b.abs = t.shl(t, uint(allBits-x.exp))
int.go#L35: abs nat // absolute value of the integer
int.go#L49: if len(x.abs) == 0 {
int.go#L65: z.abs = z.abs.setUint64(uint64(x))
int.go#L72: z.abs = z.abs.setUint64(x)
int.go#L92: return &Int{neg: x < 0, abs: abs}
int.go#L98: z.abs = z.abs.set(x.abs)
int.go#L113: return x.abs
int.go#L122: z.abs = nat(abs).norm()
int.go#L137: z.neg = len(z.abs) > 0 && !z.neg // 0 has no sign
int.go#L147: z.abs = z.abs.add(x.abs, y.abs)
int.go#L151: if x.abs.cmp(y.abs) >= 0 {
int.go#L152: z.abs = z.abs.sub(x.abs, y.abs)
int.go#L155: z.abs = z.abs.sub(y.abs, x.abs)
int.go#L158: z.neg = len(z.abs) > 0 && neg // 0 has no sign
int.go#L168: z.abs = z.abs.add(x.abs, y.abs)
int.go#L172: if x.abs.cmp(y.abs) >= 0 {
int.go#L173: z.abs = z.abs.sub(x.abs, y.abs)
int.go#L176: z.abs = z.abs.sub(y.abs, x.abs)
int.go#L179: z.neg = len(z.abs) > 0 && neg // 0 has no sign
int.go#L190: z.abs = z.abs.sqr(x.abs)
int.go#L194: z.abs = z.abs.mul(x.abs, y.abs)
int.go#L195: z.neg = len(z.abs) > 0 && x.neg != y.neg // 0 has no sign
int.go#L217: z.abs = z.abs.mulRange(uint64(a), uint64(b))
int.go#L268: z.abs, _ = z.abs.div(nil, x.abs, y.abs)
int.go#L269: z.neg = len(z.abs) > 0 && x.neg != y.neg // 0 has no sign
int.go#L277: _, z.abs = nat(nil).div(z.abs, x.abs, y.abs)
int.go#L278: z.neg = len(z.abs) > 0 && x.neg // 0 has no sign
int.go#L294: z.abs, r.abs = z.abs.div(r.abs, x.abs, y.abs)
int.go#L295: z.neg, r.neg = len(z.abs) > 0 && x.neg != y.neg, len(r.abs) > 0 && x.neg // 0 has no sign
int.go#L321: if z == y || alias(z.abs, y.abs) {
int.go#L352: if z == y || alias(z.abs, y.abs) {
int.go#L382: r = x.abs.cmp(y.abs)
int.go#L400: return x.abs.cmp(y.abs)
int.go#L426: v := int64(low64(x.abs))
int.go#L436: return low64(x.abs)
int.go#L441: if len(x.abs) <= 64/_W {
int.go#L442: w := int64(low64(x.abs))
int.go#L450: return !x.neg && len(x.abs) <= 64/_W
int.go#L456: n := x.abs.bitLen() // NB: still uses slow crypto impl!
int.go#L462: if n <= 53 || n < 64 && n-int(x.abs.trailingZeroBits()) <= 53 {
int.go#L463: f := float64(low64(x.abs))
int.go#L515: z.abs = z.abs.setBytes(buf)
int.go#L527: buf := make([]byte, len(x.abs)*_S)
int.go#L528: return buf[x.abs.bytes(buf):]
int.go#L540: x.abs.bytes(buf)
int.go#L550: return x.abs.bitLen()
int.go#L556: return x.abs.trailingZeroBits()
int.go#L575: xWords := x.abs
int.go#L577: if m == nil || len(m.abs) == 0 {
int.go#L585: xWords = inverse.abs
int.go#L587: yWords := y.abs
int.go#L591: if z == m || alias(z.abs, m.abs) {
int.go#L594: mWords = m.abs // m.abs may be nil for m == 0
int.go#L597: z.abs = z.abs.expNN(xWords, yWords, mWords, slow)
int.go#L598: z.neg = len(z.abs) > 0 && x.neg && len(yWords) > 0 && yWords[0]&1 == 1 // 0 has no sign
int.go#L601: z.abs = z.abs.sub(mWords, z.abs) // z == x**y mod |m| && 0 <= z < |m|
int.go#L620: if len(a.abs) == 0 || len(b.abs) == 0 {
int.go#L621: lenA, lenB, negA, negB := len(a.abs), len(b.abs), a.neg, b.neg
int.go#L666: m := len(B.abs) // m >= 2
int.go#L667: n := len(A.abs) // n >= m >= 2
int.go#L670: h := nlz(A.abs[n-1])
int.go#L671: a1 = A.abs[n-1]<<h | A.abs[n-2]>>(_W-h)
int.go#L675: a2 = B.abs[n-1]<<h | B.abs[n-2]>>(_W-h)
int.go#L677: a2 = B.abs[n-2] >> (_W - h)
int.go#L717: t.abs = t.abs.setWord(u0)
int.go#L718: s.abs = s.abs.setWord(v0)
int.go#L725: r.abs = r.abs.setWord(u1)
int.go#L726: q.abs = q.abs.setWord(v1)
int.go#L784: if A.abs.cmp(B.abs) < 0 {
int.go#L790: for len(B.abs) > 1 {
int.go#L814: if len(B.abs) > 0 {
int.go#L816: if len(A.abs) > 1 {
int.go#L820: if len(B.abs) > 0 {
int.go#L822: aWord, bWord := A.abs[0], B.abs[0]
int.go#L836: t.abs = t.abs.setWord(ua)
int.go#L837: s.abs = s.abs.setWord(va)
int.go#L850: A.abs[0] = aWord
int.go#L888: if n.neg || len(n.abs) == 0 {
int.go#L890: z.abs = nil
int.go#L894: z.abs = z.abs.random(rnd, n.abs, n.abs.bitLen())
int.go#L932: return (&Int{abs: z}).ModInverse(&Int{abs: g}, &Int{abs: n}).abs
int.go#L938: if len(y.abs) == 0 || y.abs[0]&1 == 0 {
int.go#L962: if len(a.abs) == 0 {
int.go#L966: if len(a.abs) == 0 {
int.go#L972: s := a.abs.trailingZeroBits()
int.go#L974: bmod8 := b.abs[0] & 7
int.go#L982: if b.abs[0]&3 == 3 && c.abs[0]&3 == 3 {
int.go#L1037: e := s.abs.trailingZeroBits()
int.go#L1098: case p.abs[0]%4 == 3:
int.go#L1101: case p.abs[0]%8 == 5:
int.go#L1112: z.abs = z.abs.shl(x.abs, n)
int.go#L1121: t := z.abs.sub(x.abs, natOne) // no underflow because |x| > 0
int.go#L1123: z.abs = t.add(t, natOne)
int.go#L1128: z.abs = z.abs.shr(x.abs, n)
int.go#L1138: if len(x.abs) > 0 {
int.go#L1139: return uint(x.abs[0] & 1) // bit 0 is same for -x
int.go#L1147: t := nat(nil).sub(x.abs, natOne)
int.go#L1151: return x.abs.bit(uint(i))
int.go#L1163: t := z.abs.sub(x.abs, natOne)
int.go#L1165: z.abs = t.add(t, natOne)
int.go#L1166: z.neg = len(z.abs) > 0
int.go#L1169: z.abs = z.abs.setBit(x.abs, uint(i), b)
int.go#L1179: x1 := nat(nil).sub(x.abs, natOne)
int.go#L1180: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1181: z.abs = z.abs.add(z.abs.or(x1, y1), natOne)
int.go#L1187: z.abs = z.abs.and(x.abs, y.abs)
int.go#L1198: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1199: z.abs = z.abs.andNot(x.abs, y1)
int.go#L1209: x1 := nat(nil).sub(x.abs, natOne)
int.go#L1210: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1211: z.abs = z.abs.andNot(y1, x1)
int.go#L1217: z.abs = z.abs.andNot(x.abs, y.abs)
int.go#L1224: x1 := nat(nil).sub(x.abs, natOne)
int.go#L1225: z.abs = z.abs.add(z.abs.or(x1, y.abs), natOne)
int.go#L1231: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1232: z.abs = z.abs.and(x.abs, y1)
int.go#L1242: x1 := nat(nil).sub(x.abs, natOne)
int.go#L1243: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1244: z.abs = z.abs.add(z.abs.and(x1, y1), natOne)
int.go#L1250: z.abs = z.abs.or(x.abs, y.abs)
int.go#L1261: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1262: z.abs = z.abs.add(z.abs.andNot(y1, x.abs), natOne)
int.go#L1272: x1 := nat(nil).sub(x.abs, natOne)
int.go#L1273: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1274: z.abs = z.abs.xor(x1, y1)
int.go#L1280: z.abs = z.abs.xor(x.abs, y.abs)
int.go#L1291: y1 := nat(nil).sub(y.abs, natOne)
int.go#L1292: z.abs = z.abs.add(z.abs.xor(x.abs, y1), natOne)
int.go#L1301: z.abs = z.abs.sub(x.abs, natOne)
int.go#L1307: z.abs = z.abs.add(x.abs, natOne)
int.go#L1319: z.abs = z.abs.sqrt(x.abs)
intconv.go#L25: return string(x.abs.itoa(x.neg, base))
intconv.go#L34: return append(buf, x.abs.itoa(x.neg, base)...)
intconv.go#L118: digits := x.abs.utoa(base)
intconv.go#L188: z.abs, base, _, err = z.abs.scan(r, base, false)
intconv.go#L192: z.neg = len(z.abs) > 0 && neg // 0 has no sign
intmarsh.go#L22: buf := make([]byte, 1+len(x.abs)*_S) // extra byte for version and sign bit
intmarsh.go#L23: i := x.abs.bytes(buf) - 1 // i >= 0
intmarsh.go#L44: z.abs = z.abs.setBytes(buf[1:])
intmarsh.go#L53: return x.abs.itoa(x.neg, 10), nil
intmarsh.go#L73: return x.abs.itoa(x.neg, 10), nil
prime.go#L39: if x.neg || len(x.abs) == 0 {
prime.go#L48: w := x.abs[0]
prime.go#L49: if len(x.abs) == 1 && w < 64 {
prime.go#L63: rA = uint32(x.abs.modW(primesA))
prime.go#L64: rB = uint32(x.abs.modW(primesB))
prime.go#L66: r := x.abs.modW((primesA * primesB) & _M)
prime.go#L78: return x.abs.probablyPrimeMillerRabin(n+1, true) && x.abs.probablyPrimeLucas()
prime.go#L171: intD := &Int{abs: d}
prime.go#L172: intN := &Int{abs: n}
rat.go#L274: b := x.b.abs
rat.go#L278: f, exact = quotToFloat32(x.a.abs, b)
rat.go#L290: b := x.b.abs
rat.go#L294: f, exact = quotToFloat64(x.a.abs, b)
rat.go#L305: babs := b.abs
rat.go#L309: if &z.a == b || alias(z.a.abs, babs) {
rat.go#L312: z.a.abs = z.a.abs.set(a.abs)
rat.go#L313: z.b.abs = z.b.abs.set(babs)
rat.go#L328: z.b.abs = z.b.abs.setUint64(uint64(b))
rat.go#L335: z.b.abs = z.b.abs.setWord(1)
rat.go#L342: z.b.abs = z.b.abs.setWord(1)
rat.go#L349: z.b.abs = z.b.abs.setWord(1)
rat.go#L359: if len(z.b.abs) == 0 {
rat.go#L360: z.b.abs = z.b.abs.setWord(1)
rat.go#L375: z.a.neg = len(z.a.abs) > 0 && !z.a.neg // 0 has no sign
rat.go#L382: if len(x.a.abs) == 0 {
rat.go#L386: z.a.abs, z.b.abs = z.b.abs, z.a.abs
rat.go#L401: return len(x.b.abs) == 0 || x.b.abs.cmp(natOne) == 0
rat.go#L421: if len(x.b.abs) == 0 {
rat.go#L425: return &Int{abs: nat{1}}
rat.go#L432: case len(z.a.abs) == 0:
rat.go#L436: case len(z.b.abs) == 0:
rat.go#L438: z.b.abs = z.b.abs.setWord(1)
rat.go#L445: z.a.abs, _ = z.a.abs.div(nil, z.a.abs, f.abs)
rat.go#L446: z.b.abs, _ = z.b.abs.div(nil, z.b.abs, f.abs)
rat.go#L475: z.abs = z.abs.mul(x.abs, f)
rat.go#L486: a.scaleDenom(&x.a, y.b.abs)
rat.go#L487: b.scaleDenom(&y.a, x.b.abs)
rat.go#L494: a1.scaleDenom(&x.a, y.b.abs)
rat.go#L495: a2.scaleDenom(&y.a, x.b.abs)
rat.go#L497: z.b.abs = mulDenom(z.b.abs, x.b.abs, y.b.abs)
rat.go#L504: a1.scaleDenom(&x.a, y.b.abs)
rat.go#L505: a2.scaleDenom(&y.a, x.b.abs)
rat.go#L507: z.b.abs = mulDenom(z.b.abs, x.b.abs, y.b.abs)
rat.go#L516: z.a.abs = z.a.abs.sqr(x.a.abs)
rat.go#L517: if len(x.b.abs) == 0 {
rat.go#L518: z.b.abs = z.b.abs.setWord(1)
rat.go#L520: z.b.abs = z.b.abs.sqr(x.b.abs)
rat.go#L525: z.b.abs = mulDenom(z.b.abs, x.b.abs, y.b.abs)
rat.go#L532: if len(y.a.abs) == 0 {
rat.go#L536: a.scaleDenom(&x.a, y.b.abs)
rat.go#L537: b.scaleDenom(&y.a, x.b.abs)
rat.go#L538: z.a.abs = a.abs
rat.go#L539: z.b.abs = b.abs
ratconv.go#L71: if z.b.abs, _, _, err = z.b.abs.scan(r, 0, false); err != nil {
ratconv.go#L78: if len(z.b.abs) == 0 {
ratconv.go#L96: z.a.abs, base, fcount, err = z.a.abs.scan(r, 0, true)
ratconv.go#L115: if len(z.a.abs) == 0 {
ratconv.go#L181: pow5 := z.b.abs.expNN(natFive, nat(nil).setWord(Word(n)), nil, false) // use underlying array of z.b.abs
ratconv.go#L183: z.a.abs = z.a.abs.mul(z.a.abs, pow5)
ratconv.go#L184: z.b.abs = z.b.abs.setWord(1)
ratconv.go#L186: z.b.abs = pow5
ratconv.go#L189: z.b.abs = z.b.abs.setWord(1)
ratconv.go#L197: z.a.abs = z.a.abs.shl(z.a.abs, uint(exp2))
ratconv.go#L199: z.b.abs = z.b.abs.shl(z.b.abs, uint(-exp2))
ratconv.go#L202: z.a.neg = neg && len(z.a.abs) > 0 // 0 has no sign
ratconv.go#L310: if len(x.b.abs) != 0 {
ratconv.go#L345: q, r := nat(nil).div(nat(nil), x.a.abs, x.b.abs)
ratconv.go#L353: r, r2 := r.div(nat(nil), r, x.b.abs)
ratconv.go#L357: if x.b.abs.cmp(r2) <= 0 {
ratmarsh.go#L24: buf := make([]byte, 1+4+(len(x.a.abs)+len(x.b.abs))*_S) // extra bytes for version and sign bit (1), and numerator length (4)
ratmarsh.go#L25: i := x.b.abs.bytes(buf)
ratmarsh.go#L26: j := x.a.abs.bytes(buf[:i])
ratmarsh.go#L66: z.a.abs = z.a.abs.setBytes(buf[j:i])
ratmarsh.go#L67: z.b.abs = z.b.abs.setBytes(buf[i:])
|
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |